/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package crm.entity;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author abet
 */
@Entity
@Table (name="users")
public class User {
    @Id 
    @Column(name="user_id", length=10, nullable=false)
    private String userId;
    @Column(name="username", length=255, nullable=false,unique=true)
    private String userName;
    @Column(name="password", length=255, nullable=false)
    private String userPass;
    @Column(name="real_name", length=255, nullable=false,unique=true)
    private String realName;
    @Column(name="user_role", length=255, nullable=false)
    private String userRole;
    @OneToMany(mappedBy="user", cascade=CascadeType.ALL,orphanRemoval=true)
    private List<Role> role = new ArrayList<Role>();

    public List<Role> getRole() {
        return role;
    }

    public void setRole(List<Role> role) {
        this.role = role;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPass() {
        return userPass;
    }

    public void setUserPass(String userPass) {
        this.userPass = userPass;
    }

    public String getUserRole() {
        return userRole;
    }

    public void setUserRole(String userRole) {
        this.userRole = userRole;
    }
}
